@import 'buttons.css';

body {
      box-sizing: border-box;
      background-color: white;
      color: #0f172a;
    }
    
    .logo-font {
      font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    }
    
    .main-container {
      height: 100%;
      width: 100%;
      padding: 5rem 2rem 2rem 2rem;
      overflow: auto;
    }
    
    .taskbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      z-index: 1000;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      display: flex;
      flex-direction: column;
      align-items: center;
    }
    
    .taskbar-container {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: var(--taskbar-gap, 1rem);
      padding: 0.5rem 1rem;
      max-width: 95%; 
      width: 100%;
      flex-wrap: wrap;
    }
    
    .taskbar-button {
      padding: var(--taskbar-padding-y, 0.5rem) var(--taskbar-padding-x, 1rem);
      font-size: var(--taskbar-font-size, 0.875rem);
      border-radius: 0.5rem;
      font-weight: 600;
      color: white;
      transition: opacity 0.3s, transform 0.2s;
      background: rgba(255, 255, 255, 0.1);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      white-space: nowrap;
      text-decoration: none;
    }
    
    .taskbar-button:hover {
      opacity: 0.9;
      scale: 1.05;
      background: rgba(255, 255, 255, 0.2);
    }

    .settings-menu {
      width: 13rem;
      padding: 0.5rem;
      background: #ffffff;
      border-radius: 0.5rem;
      box-shadow: 0 8px 20px rgba(2,6,23,0.12);
      color: #0f172a;
      font-size: 0.95rem;
      visibility: hidden;
      opacity: 0;
      transform: translateY(-6px);
      transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
      position: fixed;
      z-index: 10000;
    }

    body.dark-mode .settings-menu {
      background: #0f172a;
      color: #cbd5e1;
    }

    .page-title {
      font-size: 2.25rem;
      font-weight: 700;
      margin-bottom: 1rem;
      background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
      display: inline-block;
    }

    .courses-container {
      background: #f8fafc;
      border-radius: 2rem;
      border: 2px solid rgba(15, 23, 42, 0.15);
      min-height: 32rem;
      padding: 2rem;
      margin-bottom: 2rem;
      position: relative;
    }

    .courses-section {
      margin-bottom: 2rem;
    }

    .lesson-layout {
      display: flex;
      gap: 1.5rem;
      align-items: flex-start;
      width: 100%;
    }

    /* Embedded Summary Styles */
    .lesson-notes {
      margin-top: 1.5rem;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 1rem;
      padding: 1.5rem 1.75rem;
      box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
      color: #0f172a;
    }

    .lesson-notes h3 {
      font-size: 1.2rem;
      font-weight: 700;
      color: #0f172a;
      margin-bottom: 0.5rem;
    }

    .lesson-notes p {
      margin-bottom: 1rem;
      color: #1e293b;
    }

    .lesson-notes ul {
      margin: 0 0 1.25rem 1.25rem;
      color: #1e293b;
      list-style: disc;
    }

    .lesson-notes li {
      margin-bottom: 0.35rem;
    }
    
    .diagram-card {
      background: rgba(255, 255, 255, 0.95);
      border-radius: 1rem;
      padding: 1.5rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      margin-top: 1.5rem;
      position: relative;
    }

    body.dark-mode .lesson-notes {
      background: #0f172a;
      border: 1px solid #1e293b;
      box-shadow: 0 10px 18px rgba(2, 6, 23, 0.35);
      color: #e2e8f0;
    }

    body.dark-mode .lesson-notes h3 {
      color: #f8fafc;
    }

    body.dark-mode .lesson-notes p,
    body.dark-mode .lesson-notes ul {
      color: #e2e8f0;
    }

    body.dark-mode .diagram-card {
      background: rgba(15, 23, 42, 0.85);
    }
    
    .summary-actions {
      margin-top: 1.5rem;
      display: flex;
      justify-content: flex-end;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    .side-buttons {
      position: absolute;
      right: 2rem;
      bottom: 9rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      z-index: 30;
      align-items: flex-end;
      pointer-events: auto;
    }

    /* Flashcard Styles */
    body.dark-mode .flashcard-box {
      background: #1e293b !important;
      color: #e2e8f0 !important;
      box-shadow: 0 2px 12px rgba(0,0,0,0.35) !important;
      border: 1.5px solid #334155;
    }
    body.dark-mode #prev-flashcard {
      background: #b91c1c !important;
      color: #fff !important;
    }
    body.dark-mode #next-flashcard {
      background: #059669 !important;
      color: #fff !important;
    }
    body.dark-mode .flashcard-box svg {
      filter: drop-shadow(0 0 2px #0f172a);
    }
    #shuffle-flashcard {
      background: #6366f1;
      color: #fff;
      border: none;
      border-radius: 0.5rem;
      padding: 0.75rem 1.5rem;
      cursor: pointer;
      font-weight: 600;
      margin-left: 1rem;
      display: flex;
      align-items: center;
      gap: 0.5rem;
      box-shadow: 0 2px 8px rgba(0,0,0,0.12);
      transition: background 0.2s;
    }
    #shuffle-flashcard:hover {
      background: #4f46e5;
    }
    body.dark-mode #shuffle-flashcard {
      background: #3730a3;
    }
    body.dark-mode #shuffle-flashcard:hover {
      background: #312e81;
    }

    .side-button {
      padding: 1rem 1.5rem;
      border-radius: 0.75rem;
      font-weight: 600;
      color: #ffffff;
      font-size: 1rem;
      border: none;
      cursor: pointer;
      background: linear-gradient(135deg, #8b5cf6 0%, #10b981 50%, #3b82f6 100%);
      box-shadow: 0 6px 14px rgba(15, 23, 42, 0.2);
      min-width: 11rem;
      display: inline-flex;
      justify-content: center;
      align-items: center;
      text-decoration: none;
      text-align: center;
    }
    .side-button:hover {
      opacity: 0.9;
      transform: scale(1.1);
    }
    .videos-panel {
      width: 12rem;
      min-height: 6rem;
      pointer-events: auto;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      display: block;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.25rem);
      z-index: 10;
      opacity: 0;
      transform-origin: bottom right;
      transform: scale(3);
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem 0.7rem;
    }

    .videos-panel.is-open {
      opacity: 0.9;
      visibility: visible;
      pointer-events: auto;
      animation: panelFadeIn 0.25s ease-out;
    }

    .Practice-actions {
      margin-top: 1.5rem;
      display: flex;
      justify-content: flex-end;
    }

    /* Scaled Quiz Styles */
    #quiz-content-view .quiz-question p {
      font-size: 1.45rem !important; /* Scaled from 1.1rem */
    }
    #quiz-content-view label {
      font-size: 1.3rem !important; /* Scaled from base */
    }
    #quiz-content-view .side-button {
      font-size: 1.3rem !important;
    }
    #quiz-content-view input[type="radio"] {
      transform: scale(1.3);
      margin-right: 0.75rem !important;
    }
    #quiz-content-view .attempts-indicator {
      font-size: 1.25rem !important;
      color: #64748b;
      margin-bottom: 0.5rem;
      font-weight: 700;
    }

    .Practices-menu {
      position: relative;
    }

    .Practices-panel {
      width: 12rem;
      min-height: 3rem;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.25rem);
      z-index: 10;
      opacity: 0;
      transform: scale(0.95);
      transform-origin: bottom right;
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem;
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    }

    .Practices-panel.is-open {
      opacity: 0.95;
      visibility: visible;
      pointer-events: auto;
      transform: scale(1);
    }
    
    .Practices-panel a {
      display: block;
      color: #e2e8f0;
      text-decoration: none;
      padding: 0.5rem;
      border-radius: 0.25rem;
      font-size: 0.9rem;
      font-weight: 500;
    }
    
    .Practices-panel a:hover {
      background: rgba(255, 255, 255, 0.1);
      color: white;
    }

    .videos-panel-title {
      font-size: 0.65rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #cbd5f5;
      margin-bottom: 0.45rem;
    }

    .videos-panel a {
      display: block;
      font-size: 0.7rem;
      line-height: 1.2;
      color: #e2e8f0;
      text-decoration: none;
      margin-bottom: 0.35rem;
    }

    .videos-panel a:hover {
      color: #93c5fd;
    }

    .videos-panel-legend {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.2rem;
      margin-bottom: 0.35rem;
      margin-left: auto;
      width: 3.2rem;
    }

    .videos-panel-legend span {
      font-size: 0.45rem;
      font-weight: 700;
      color: #cbd5f5;
      text-align: center;
      letter-spacing: 0.04em;
    }

    .videos-panel-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .video-info-text {
      position: absolute;
      left: 0.75rem;
      top: calc(100% - 5.25rem);
      width: calc(100% - 0.75rem);
      z-index: 5;
      border: 2px solid #e2e8f0;
      border-radius: 0.9rem;
      background: #ffffff;
      color: #1e293b;
      padding: 0.8rem 1.1rem;
      text-align: center;
      opacity: 0;
      transition: opacity 0.4s ease;
      display: none;
    }

    body.dark-mode .video-info-text {
      border-color: #334155;
      background: #0f172a;
      color: #e2e8f0;
    }

    .video-info-text.is-visible {
      display: block;
      opacity: 0.95;
    }

    .video-info-text.is-fading {
      opacity: 0;
    }

    .videos-panel-item:last-child a {
      margin-bottom: 0;
    }

    .mini-rubric {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      width: 3.2rem;
      height: 0.45rem;
      border-radius: 999px;
      overflow: hidden;
      border: 1px solid rgba(148, 163, 184, 0.7);
      flex-shrink: 0;
    }

    .mini-rubric span {
      display: block;
      height: 100%;
    }

    .side-buttons.videos-open .videos-panel {
      display: block;
    }

    .rubric-box {
      position: absolute;
      top: 1.5rem;
      right: 2rem;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 0.5rem;
      z-index: 8;
    }

    .rubric-hover-wrap {
      position: absolute;
      top: 0;
      right: 0;
      z-index: 20;
    }

    .rubric-hover-dot {
      scale: 2.2;
      width: 1.4rem;
      height: 1.4rem;
      border-radius: 999px;
      margin-right: -0.5rem;
      margin-top: 4.3rem;
      transform: translateY(-0.25rem);
      border: 2px solid #cbd5e1;
      background: #ffffff;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
      cursor: pointer;
      position: relative;
      z-index: 21;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      font-weight: 700;
    }

    body.dark-mode .rubric-hover-dot {
      border-color: #1f2937;
      background: #0f172a;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
    }

    .rubric-hover-dot span {
      font-family: 'Playfair Display', 'Poppins', serif;
      background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
    }

    .rubric-hover-panel {
      position: absolute;
      margin-right: 1.5rem;
      scale: 1.6;
      right: 0;
      bottom: calc(100% + 5.5rem);
      width: 10rem;
      min-height: 3rem;
      background: #ffffff;
      border: 2px solid #e2e8f0;
      border-radius: 0.75rem;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-0.25rem);
      transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    }

    body.dark-mode .rubric-hover-panel {
      background: #0f172a;
      border-color: #334155;
    }

    .rubric-hover-panel p {
      font-size: 0.7rem;
      line-height: 1.2;
      margin: 0.25rem 0;
      color: #334155;
    }

    body.dark-mode .rubric-hover-panel p {
      color: #cbd5e1;
    }

    .rubric-hover-wrap:hover .rubric-hover-panel {
      opacity: 0.9;
      visibility: visible;
      transform: translateY(5rem);
    }

    .rubric-box .page-title {
      margin-bottom: 0;
      transform: translateX(-4rem);
    }

    .rubric-card {
      background: #f8fafc;
      border-radius: 1rem;
      border: 3px solid transparent;
      --rubric-border-gradient: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      background:
        linear-gradient(#f8fafc, #f8fafc) padding-box,
        var(--rubric-border-gradient) border-box;
      width: 20rem;
      height: 9rem;
      margin-top: 25rem;
      padding: 0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      transform: scale(1.2) rotate(90deg);  
      transform-origin: top right;
      overflow: hidden;
    }
    .rubric-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0;
      height: 100%;
    }

    .rubric-item {
      padding: 0;
      text-align: center;
      font-size: 0.85rem;
      color: #0f172a;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      border-right: 2px solid rgba(15, 23, 42, 0.85);
      border-left: none;
      height: 100%;
      border-bottom: none;
      border-top: none;
    }

    .rubric-item:first-child {
      border-left: none;
    }

    .rubric-text {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
      transform: rotate(-90deg);
      white-space: nowrap;
    }

    .rubric-label {
      font-weight: 600;
    }

    .rubric-rating {
      font-size: 0.7rem;
      font-weight: 600;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    .rubric-item:nth-child(1) {
      background: #90EE90;
    }

    .rubric-item:nth-child(2) {
      background: #FFD700;
    }

    .rubric-item:nth-child(3) {
      background: #7FFF00;
    }

    .rubric-item:nth-child(4) {
      background: #FFD700;
    }

    .rubric-item:last-child {
      border-right: none;
    }

    body.dark-mode .rubric-item {
      color: #0f172a;
      border-right-color: rgba(226, 232, 240, 0.85);
      border-left-color: transparent;
      border-top-color: transparent;
      border-bottom-color: transparent;
      border-top-width: 0;
      border-bottom-width: 0;
    }

    body.dark-mode .rubric-card {
      background:
        linear-gradient(#0f172a, #0f172a) padding-box,
        var(--rubric-border-gradient) border-box;
    }

    body.dark-mode .rubric-item:nth-child(1) {
      background: #90EE90;
    }

    body.dark-mode .rubric-item:nth-child(2) {
      background: #FFD700;
    }

    body.dark-mode .rubric-item:nth-child(3) {
      background: #7FFF00;
    }

    body.dark-mode .rubric-item:nth-child(4) {
      background: #FFD700;
    }

    .video-stack {
      flex: 1 1 0;
      min-width: 420px;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
      position: relative;
    }

    .video-embed {
      position: relative;
      transform: scale(0.85);
      transform-origin: top left;
      width: 100%;
      padding-top: 56.25%;
      margin-left: 0.75rem;
      margin-top: 0.5rem;
      border-radius: 1rem;
      overflow: hidden;
      background: rgba(255, 255, 255, 0.95);
      box-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
    }

    .video-embed iframe {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border: 0;
      z-index: 1;
    }

    body.dark-mode .video-embed {
      background: rgba(15, 23, 42, 0.85);
    }

    .courses-section-title {
      font-size: 1.5rem;
      font-weight: 700;
      color: #1e293b;
      margin-bottom: 1rem;
    }

    body.dark-mode .courses-section-title {
      color: #f8fafc;
    }

    .courses-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 1rem;
    }

    .course-box {
      border-radius: 1rem;
      padding: 1.25rem 0.75rem;
      text-align: center;
      transition: all 0.3s ease;
      cursor: pointer;
      color: #1e293b;
    }

    body:not(.dark-mode) .course-box {
      background: #ffffff !important;
      border: 1px solid #e2e8f0 !important;
      box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    }

    body:not(.dark-mode) .course-box:hover {
      background: #ffffff !important;
      box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    }

    .course-box:hover {
      transform: translateY(-4px);
    }

    .course-box a {
      text-decoration: none;
      color: #1e293b;
      font-size: 1.125rem;
      font-weight: 600;
      display: block;
      background: transparent !important;
      box-shadow: none !important;
    }

    .course-box a:hover {
      color: #3b82f6;
    }

    body.dark-mode .course-box {
      background: transparent !important;
      color: #cbd5e1;
      border-color: transparent !important;
      box-shadow: none !important;
    }

    body.dark-mode .course-box a {
      color: #cbd5e1;
      background: transparent !important;
    }

    body.dark-mode .course-box a:hover {
      color: #3b82f6;
    }

    body.dark-mode {
      background-color: #1e293b;
      color: #e2e8f0;
    }

    body.dark-mode .courses-container {
      background: #273244;
      border: 2px solid rgba(226, 232, 240, 0.22);
    }
    @keyframes panelFadeIn {
      from {
        opacity: 0;
        transform: scale(2.7);
      }
      to {
        opacity: 0.8;
        transform: scale(3);
      }
    }

    .lesson-notes {
      margin-top: 1.5rem;
      background: #f8fafc;
      border: 1px solid #e2e8f0;
      border-radius: 1rem;
      padding: 1.5rem 1.75rem;
      box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
      color: #0f172a;
    }

    .lesson-notes h3 {
      font-size: 1.2rem;
      font-weight: 700;
      color: #0f172a;
      margin-bottom: 0.5rem;
    }

    .lesson-notes p {
      margin-bottom: 1rem;
      color: #1e293b;
    }

    .lesson-notes ul {
      margin: 0 0 1.25rem 1.25rem;
      color: #1e293b;
      list-style: disc;
    }

    .lesson-notes li {
      margin-bottom: 0.35rem;
    }

    body.dark-mode .lesson-notes {
      background: #0f172a;
      border: 1px solid #1e293b;
      box-shadow: 0 10px 18px rgba(2, 6, 23, 0.35);
      color: #e2e8f0;
    }

    body.dark-mode .lesson-notes h3 {
      color: #f8fafc;
    }

    body.dark-mode .lesson-notes p,
    body.dark-mode .lesson-notes ul {
      color: #e2e8f0;
    }

    body.dark-mode .diagram-card {
      background: rgba(15, 23, 42, 0.85);
    }

    .diagram-placeholder {
      border: 2px dashed rgba(59, 130, 246, 0.6);
      border-radius: 0.75rem;
      padding: 2.5rem;
      text-align: center;
      color: #475569;
    }

    body.dark-mode .diagram-placeholder {
      color: #cbd5e1;
      border-color: rgba(148, 163, 184, 0.6);
    }
    
    .diagram-card {
      background: rgba(255, 255, 255, 0.95);
      border-radius: 1rem;
      padding: 1.5rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      margin-top: 1.5rem;
      position: relative;
    }
    .summary-actions {
      margin-top: 1.5rem;
      display: flex;
      justify-content: flex-end;
      gap: 0.75rem;
      flex-wrap: wrap;
    }

    /* videos-panel-overrides */
    .side-buttons {
      z-index: 30;
      pointer-events: auto;
    }

    .videos-panel {
      width: 12rem;
      min-height: 6rem;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      display: block;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.25rem);
      z-index: 10;
      opacity: 0;
      transform-origin: bottom right;
      transform: scale(3);
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem 0.7rem;
    }

    .videos-panel.is-open {
      opacity: 0.9;
      visibility: visible;
      pointer-events: auto;
      animation: panelFadeIn 0.25s ease-out;
    }

    .videos-panel-title {
      font-size: 0.65rem;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: #cbd5f5;
      margin-bottom: 0.45rem;
    }

    .videos-panel a {
      display: block;
      font-size: 0.7rem;
      line-height: 1.2;
      color: #e2e8f0;
      text-decoration: none;
      margin-bottom: 0.35rem;
    }

    .videos-panel a:hover {
      color: #93c5fd;
    }

    .videos-panel-legend {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.2rem;
      margin-bottom: 0.35rem;
      margin-left: auto;
      width: 3.2rem;
    }

    .videos-panel-legend span {
      font-size: 0.45rem;
      font-weight: 700;
      color: #cbd5f5;
      text-align: center;
      letter-spacing: 0.04em;
    }

    .videos-panel-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .videos-panel-item:last-child a {
      margin-bottom: 0;
    }

    .mini-rubric {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      width: 3.2rem;
      height: 0.45rem;
      border-radius: 999px;
      overflow: hidden;
      border: 1px solid rgba(148, 163, 184, 0.7);
      flex-shrink: 0;
    }

    .mini-rubric span {
      display: block;
      height: 100%;
    }

    .side-buttons.videos-open .videos-panel {
      display: block;
    }

    .rubric-hover-wrap {
      position: absolute;
      top: 0;
      right: 0;
      z-index: 20;
    }

    .rubric-hover-dot {
      scale: 2.2;
      width: 1.4rem;
      height: 1.4rem;
      border-radius: 999px;
      margin-right: -0.5rem;
      margin-top: 4.3rem;
      transform: translateY(-0.25rem);
      border: 2px solid #cbd5e1;
      background: #ffffff;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
      cursor: pointer;
      position: relative;
      z-index: 21;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 0.9rem;
      font-weight: 700;
    }

    body.dark-mode .rubric-hover-dot {
      border-color: #1f2937;
      background: #0f172a;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.35);
    }

    .rubric-hover-dot span {
      font-family: 'Playfair Display', 'Poppins', serif;
      background: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      background-clip: text;
      color: transparent;
    }

    .rubric-hover-panel {
      position: absolute;
      margin-right: 1.5rem;
      scale: 1.6;
      right: 0;
      bottom: calc(100% + 5.5rem);
      width: 10rem;
      min-height: 3rem;
      background: #ffffff;
      border: 2px solid #e2e8f0;
      border-radius: 0.75rem;
      opacity: 0;
      visibility: hidden;
      transform: translateY(-0.25rem);
      transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    }

    body.dark-mode .rubric-hover-panel {
      background: #0f172a;
      border-color: #334155;
    }

    .rubric-hover-panel p {
      font-size: 0.7rem;
      line-height: 1.2;
      margin: 0.25rem 0;
      color: #334155;
    }

    body.dark-mode .rubric-hover-panel p {
      color: #cbd5e1;
    }

    .rubric-hover-wrap:hover .rubric-hover-panel {
      opacity: 0.9;
      visibility: visible;
      transform: translateY(5rem);
    }

    /* rubric-overrides */
    .rubric-box .page-title {
      margin-bottom: 0;
      transform: translateX(-4rem);
    }

    .rubric-card {
      background: #f8fafc;
      border-radius: 1rem;
      border: 3px solid transparent;
      --rubric-border-gradient: linear-gradient(135deg, #3b82f6 0%, #10b981 50%, #8b5cf6 100%);
      background:
        linear-gradient(#f8fafc, #f8fafc) padding-box,
        var(--rubric-border-gradient) border-box;
      width: 20rem;
      height: 9rem;
      margin-top: 25rem;
      padding: 0;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
      transform: scale(1.2) rotate(90deg);
      transform-origin: top right;
      overflow: hidden;
    }

    .rubric-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0;
      height: 100%;
    }

    .rubric-item {
      padding: 0;
      text-align: center;
      font-size: 0.85rem;
      color: #0f172a;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      border-right: 2px solid rgba(15, 23, 42, 0.85);
      border-left: none;
      height: 100%;
      border-bottom: none;
      border-top: none;
    }

    .rubric-item:first-child {
      border-left: none;
    }

    .rubric-item:last-child {
      border-right: none;
    }

    .rubric-text {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
      transform: rotate(-90deg);
      white-space: nowrap;
    }

    .rubric-label {
      font-weight: 600;
    }

    .rubric-rating {
      font-size: 0.7rem;
      font-weight: 600;
      letter-spacing: 0.02em;
      text-transform: uppercase;
    }

    body.dark-mode .rubric-item {
      color: #0f172a;
      border-right-color: rgba(226, 232, 240, 0.85);
      border-left-color: transparent;
      border-top-color: transparent;
      border-bottom-color: transparent;
      border-top-width: 0;
      border-bottom-width: 0;
    }

    body.dark-mode .rubric-card {
      background:
        linear-gradient(#0f172a, #0f172a) padding-box,
        var(--rubric-border-gradient) border-box;
    }

    /* rubric-hover-interactions */
    .rubric-hover-wrap {
      pointer-events: auto;
    }

    .rubric-hover-dot {
      pointer-events: auto;
    }

    .rubric-hover-panel {
      z-index: 30;
      pointer-events: none;
    }

    .rubric-hover-wrap.is-open .rubric-hover-panel,
    .rubric-hover-wrap:focus-within .rubric-hover-panel {
      opacity: 0.9;
      visibility: visible;
      transform: translateY(5rem);
      pointer-events: auto;
    }

    /* Embedded Game Styles Swapped In */
    .Practices-menu {
      position: relative;
      display: inline-block;
    }
    .Practices-panel {
      position: absolute;
      bottom: 100%;
      right: 0;
      width: 12rem;
      background: #ffffff;
      border: 1px solid #e2e8f0;
      border-radius: 0.75rem;
      box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
      padding: 0.5rem;
      margin-bottom: 0.5rem;
      opacity: 0;
      visibility: hidden;
      transform: translateY(10px);
      transition: all 0.2s ease-out;
      z-index: 50;
    }
    .Practices-panel.is-open {
      opacity: 1;
      visibility: visible;
      transform: translateY(0);
    }
    body.dark-mode .Practices-panel {
      background: #1e293b;
      border-color: #334155;
    }
    .Practices-panel-item a {
      display: block;
      padding: 0.75rem 1rem;
      color: #334155;
      text-decoration: none;
      border-radius: 0.5rem;
      transition: background-color 0.15s;
    }
    .Practices-panel-item a:hover {
      background-color: #f1f5f9;
      color: #0f172a;
    }
    body.dark-mode .Practices-panel-item a {
      color: #cbd5e1;
    }
    body.dark-mode .Practices-panel-item a:hover {
      background-color: #334155;
      color: #f8fafc;
    }

    /* Mix & Match Styles */
    .mix-match-board {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
      gap: 1rem;
      margin-top: 1.5rem;
      width: 100%;
    }
    .mm-card {
      background: #f8fafc;
      border: 2px solid #e2e8f0;
      border-radius: 0.75rem;
      padding: 1.5rem;
      min-height: 100px;
      display: flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      cursor: pointer;
      font-weight: 500;
      color: #334155;
      transition: all 0.2s;
      user-select: none;
      box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    body.dark-mode .mm-card {
      background: #1e293b;
      border-color: #334155;
      color: #cbd5e1;
    }
    .mm-card:hover {
      transform: translateY(-2px);
      box-shadow: 0 4px 6px rgba(0,0,0,0.1);
      border-color: #94a3b8;
    }
    .mm-card.selected {
      background: #eff6ff;
      border-color: #3b82f6;
      color: #1d4ed8;
      transform: scale(1.02);
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    }
    body.dark-mode .mm-card.selected {
      background: #172554;
      border-color: #60a5fa;
      color: #bfdbfe;
    }
    .mm-card.matched {
      background: #f0fdf4;
      border-color: #22c55e;
      color: #15803d;
      opacity: 0.8;
      cursor: default;
    }
    body.dark-mode .mm-card.matched {
      background: #052e16;
      border-color: #22c55e;
      color: #86efac;
    }
    .mm-card.wrong {
      background: #fef2f2;
      border-color: #ef4444;
      animation: shake 0.5s;
    }
    body.dark-mode .mm-card.wrong {
      background: #450a0a;
      border-color: #ef4444;
    }
    @keyframes shake {
      0%, 100% { transform: translateX(0); }
      25% { transform: translateX(-5px); }
      75% { transform: translateX(5px); }
    }
    .mm-modal {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0,0,0,0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 100;
      opacity: 0;
      visibility: hidden;
      transition: all 0.3s;
    }
    .mm-modal.active {
      opacity: 1;
      visibility: visible;
    }
    .mm-modal-content {
      background: white;
      padding: 2rem;
      border-radius: 1rem;
      text-align: center;
      max-width: 90%;
      width: 400px;
      transform: scale(0.9);
      transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .mm-modal.active .mm-modal-content {
      transform: scale(1);
    }
    body.dark-mode .mm-modal-content {
      background: #1e293b;
      color: #ffffff;
    }

    /* Block Puzzle Styles */
    .block-puzzle-container {
      width: 100%;
      max-width: 600px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1.5rem;
    }
    .bp-grid {
      display: grid;
      grid-template-columns: repeat(8, 1fr);
      gap: 2px;
      background: #cbd5e1;
      padding: 2px;
      border-radius: 0.5rem;
      width: 100%;
      aspect-ratio: 1;
    }
    body.dark-mode .bp-grid {
      background: #475569;
    }
    .bp-cell {
      background: #f1f5f9;
      border-radius: 2px;
      position: relative;
    }
    body.dark-mode .bp-cell {
      background: #334155;
    }
    .bp-cell.filled {
      background: #3b82f6; 
      box-shadow: inset 0 0 4px rgba(0,0,0,0.2);
    }
    .bp-blocks-area {
      display: flex;
      justify-content: center;
      gap: 2rem;
      min-height: 120px;
      width: 100%;
      padding: 1rem;
      background: rgba(241, 245, 249, 0.5);
      border-radius: 1rem;
    }
    body.dark-mode .bp-blocks-area {
      background: rgba(30, 41, 59, 0.5);
    }
    .bp-block-option {
      cursor: grab;
      transition: transform 0.2s;
    }
    .bp-block-option:active {
      cursor: grabbing;
      transform: scale(1.1);
    }
    .bp-preview {
      display: grid;
      gap: 2px;
      pointer-events: none;
    }
    .bp-preview-cell {
      width: 20px;
      height: 20px;
      border-radius: 2px;
    }/* Fixed Practices Menu CSS */
    .Practices-menu {
      position: relative;
      display: inline-block;
    }
    
    .Practices-panel {
      width: 12rem;
      min-height: 3rem;
      background: #0f172a;
      border: 2px solid #334155;
      border-radius: 0.75rem;
      position: absolute;
      right: 0;
      bottom: calc(100% + 0.5rem);
      z-index: 50; /* Increased z-index */
      opacity: 0;
      transform: scale(0.95);
      transform-origin: bottom right;
      visibility: hidden;
      pointer-events: none;
      padding: 0.6rem;
      transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
      box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    }

    .Practices-panel.is-open {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
      transform: scale(1);
    }

    .Practices-panel-item {
      margin-bottom: 0.5rem;
    }
    
    .Practices-panel a {
      display: block;
      color: #e2e8f0;
      text-decoration: none;
      padding: 0.5rem;
      border-radius: 0.25rem;
      font-size: 0.9rem;
      font-weight: 500;
      transition: background-color 0.2s;
    }

    .Practices-panel a:hover {
      background: rgba(255, 255, 255, 0.1);
      color: white;
    }

    /* ===================== */
    /* Climb / Boost Game    */
    /* ===================== */
    @keyframes twinkle {
      0%   { opacity: 0.3; transform: scale(0.8); }
      100% { opacity: 1;   transform: scale(1.2); }
    }
    @keyframes floatPlanet {
      0%   { transform: translateY(0px);   }
      50%  { transform: translateY(-20px); }
      100% { transform: translateY(0px);   }
    }
    @keyframes slideLadder {
      from { background-position: 0 0;    }
      to   { background-position: 0 40px; }
    }
    .climb-option-btn {
      background: #f1f5f9;
      border: 2px solid #e2e8f0;
      padding: 0.75rem;
      border-radius: 0.5rem;
      cursor: pointer;
      font-size: 1rem;
      color: #334155;
      transition: all 0.2s;
      text-align: left;
    }
    .climb-option-btn:hover {
      background: #e2e8f0;
      border-color: #cbd5e1;
    }
    /* Light Mode (Day Sky) */
    body:not(.dark-mode) #climb-space-bg {
      background: radial-gradient(ellipse at bottom, #bae6fd 0%, #0369a1 100%) !important;
    }
    body:not(.dark-mode) #climb-stars div {
      opacity: 0.3 !important;
    }
    /* Dark Mode */
    body.dark-mode #climb-game-ui { background-color: #0f172a !important; }
    body.dark-mode #climb-ladder-bg { background-image: repeating-linear-gradient(180deg, #334155 0, #334155 2px, transparent 2px, transparent 40px) !important; opacity: 0.2 !important; }
    body.dark-mode #climb-header { background: rgba(15, 23, 42, 0.95) !important; box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important; }
    body.dark-mode #climb-score { color: #e2e8f0 !important; }
    body.dark-mode #climb-interaction { background: #1e293b !important; border-color: #334155 !important; }
    body.dark-mode #climb-start-screen h3, body.dark-mode #climb-game-over h3, body.dark-mode #climb-paused-screen h3 { color: #f8fafc !important; }
    body.dark-mode #climb-start-screen p, body.dark-mode #climb-game-over p, body.dark-mode #climb-question-text { color: #cbd5e1 !important; }
    body.dark-mode .climb-option-btn { background: #334155 !important; border-color: #475569 !important; color: #e2e8f0 !important; }
    body.dark-mode .climb-option-btn:hover { background: #475569 !important; border-color: #64748b !important; }
    body.dark-mode #climb-fullscreen-btn { background: rgba(30, 41, 59, 0.9) !important; }
    body.dark-mode #climb-fullscreen-btn svg { stroke: #e2e8f0 !important; }
    body.dark-mode #climb-start-screen, body.dark-mode #climb-game-over, body.dark-mode #climb-paused-screen { background: rgba(30, 41, 59, 0.95) !important; border-color: #475569 !important; }
    body.dark-mode #climb-start-screen div { color: #cbd5e1 !important; }
    body.dark-mode #climb-fuel-text { color: #e2e8f0 !important; }

/* =====================================================
   LIGHT MODE OVERRIDES — Fix hardcoded dark-only styles
   ===================================================== */

/* Videos Panel - light mode */
body:not(.dark-mode) .videos-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .videos-panel-title {
    color: #475569;
}

body:not(.dark-mode) .videos-panel a {
    color: #334155;
}

body:not(.dark-mode) .videos-panel a:hover {
    color: #3b82f6;
}

body:not(.dark-mode) .videos-panel-legend span {
    color: #475569;
}

/* Video Info Text - light mode */
body:not(.dark-mode) .video-info-text {
    background: #ffffff;
    border-color: #e2e8f0;
    color: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Rubric Hover Dot - light mode */
body:not(.dark-mode) .rubric-hover-dot {
    border-color: #cbd5e1;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

/* Rubric Hover Panel - light mode */
body:not(.dark-mode) .rubric-hover-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .rubric-hover-panel p {
    color: #334155;
}

/* Practices Panel - light mode */
body:not(.dark-mode) .Practices-panel {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) .Practices-panel a {
    color: #334155;
}

body:not(.dark-mode) .Practices-panel a:hover {
    background: #f1f5f9;
    color: #0f172a;
}

/* Courses Section Title - light mode */
body:not(.dark-mode) .courses-section-title {
    color: #1e293b;
}

/* Taskbar Mobile Responsiveness - from LoginSignup.html */
@media (max-width: 640px) {
  .taskbar-container {
    gap: 0.5rem;
    padding: 0.5rem;
    flex-wrap: wrap;
  }

  .taskbar-button {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }
  
  .courses-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  .logo-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    margin-bottom: 2rem;
  }
  
  .company-title {
    font-size: 2.5rem;
    line-height: 1.2;
    text-align: center;
    word-wrap: break-word;
    margin-bottom: 1rem;
  }

  .content-wrapper {
    padding: 0 1rem;
  }
  
  /* Flashcard responsiveness */
  .flashcard-box[style*="min-width"] {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 90vw !important;
    padding: 1.5rem !important;
    min-height: 200px !important;
  }
  
  /* Flashcard game container */
  .flashcard-game {
    width: 100% !important;
    padding: 0 1rem !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  
  /* Flashcard Content Text */
  #flashcard-content {
    font-size: 1rem !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  
  /* Button container below flashcard */
  .flashcard-game > div:not(.flashcard-box) {
    flex-wrap: wrap !important;
    justify-content: center !important;
    width: 100% !important;
  }
  
  /* Buttons themselves */
  .flashcard-game button {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
  }
  
  /* Ensure diagram card doesn't overflow */
  .diagram-card {
    max-width: 100% !important;
    overflow-x: hidden !important;
  }
}


/* Fix for subject pages with complex inline grid styles */
@media (max-width: 1024px) {
   div[style*="grid-template-columns: repeat(4, 1fr)"],
   div[style*="grid-template-columns:repeat(4, 1fr)"],
   div[style*="grid-template-columns: repeat(3, 1fr)"],
   div[style*="grid-template-columns:repeat(3, 1fr)"],
   div[style*="grid-template-columns: repeat(4,1fr)"],
   div[style*="grid-template-columns: repeat(3,1fr)"] {
      grid-template-columns: repeat(2, 1fr) !important;
      grid-template-rows: auto !important;
      height: auto !important;
      position: relative !important;
      inset: auto !important;
      transform: none !important;
      padding-bottom: 2rem !important;
      margin-top: 2rem !important;
   }
   
   .courses-container[style*="min-height"] {
      min-height: auto !important;
      height: auto !important;
   }
}

@media (max-width: 640px) {
   div[style*="grid-template-columns: repeat(4, 1fr)"],
   div[style*="grid-template-columns:repeat(4, 1fr)"],
   div[style*="grid-template-columns: repeat(3, 1fr)"],
   div[style*="grid-template-columns:repeat(3, 1fr)"],
   div[style*="grid-template-columns: repeat(4,1fr)"],
   div[style*="grid-template-columns: repeat(3,1fr)"] {
      grid-template-columns: 1fr !important;
   }
}

/* Mobile Optimization for Lesson Pages */
@media (max-width: 1024px) {
  /* Use grid to force centering if flex fails for some reason */
  .courses-container:has(.lesson-layout) {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }

  .lesson-layout {
    display: contents !important;
  }
  
  .video-stack {
    order: 1 !important;
    min-width: 0 !important;
    width: 100% !important;
    margin-bottom: 2rem !important;
  }
  
  /* Rubric Box - Forced Width and Margin Reset */
  .rubric-box {
    order: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
  }
  
  /* Buttons container - Forced Width and Margin Reset */
  .side-buttons {
    order: 3 !important;
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0.75rem !important;
    margin: 1rem 0 !important;
    float: none !important;
    position: static !important;
    left: auto !important;
    right: auto !important;
  }
  
  /* Individual Buttons */
  .side-button, .view-other-videos {
    flex: 1 1 40% !important; /* Allow buttons to sit side-by-side */
    margin-bottom: 0 !important;
    text-align: center !important;
    min-width: 140px !important;
    padding: 0.75rem 0.5rem !important; /* Slightly smaller padding */
    font-size: 0.9rem !important; /* Slightly smaller font */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: normal !important; /* Allow multiline text if needed */
  }

  /* Un-rotate rubric and make responsive */
  .rubric-card {
    grid-row: 2 !important;
    width: 100% !important;
    max-width: 100% !important; /* Let parent constrain width */
    margin: 0 !important;
    transform: none !important;
  }
  
  .rubric-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1px !important;
    background-color: rgba(15, 23, 42, 0.1) !important;
    border: 1px solid rgba(15, 23, 42, 0.1) !important;
  }
  
  .rubric-item {
    padding: 1rem !important;
    min-height: 80px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: none !important;
    background-color: white !important; /* Override specific colors if needed, but keeping original bg colors is usually better. If original colors are used, we might need transparency or just rely on Gap */
  }
  
  /* Restore original background colors via nth-child being more specific if lost, 
     but since we are only changing layout, the original background colors on .rubric-item:nth-child should still apply 
     unless overridden by !important above. Let's fix the background. */
  .rubric-item:nth-child(1) { background: #90EE90 !important; }
  .rubric-item:nth-child(2) { background: #FFD700 !important; }
  .rubric-item:nth-child(3) { background: #7FFF00 !important; }
  .rubric-item:nth-child(4) { background: #00FFFF !important; }

  .rubric-text {
    transform: none !important; /* Text explicitly not rotated */
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 0.25rem !important;
    white-space: normal !important;
  }

  /* Rubric Header Container (New approach to align title and icon) */
  .rubric-box {
    position: relative !important;
    padding-top: 3rem !important; /* Make space for header */
  }

  .rubric-hover-dot {
    margin: 0 !important;
  }
  
  /* Target the Page Title text within rubric box */
  .rubric-box > .page-title {
    position: absolute !important;
    top: 0 !important;
    left: 50% !important; /* Start from center */
    transform: translateX(-50%) !important; /* Move back by half width (centered) */
    width: 90% !important; /* Match card width */
    max-width: 400px !important;
    text-align: left !important; /* Align text to left of this container */
    font-size: 1.5rem !important;
    margin: 0 !important;
    padding-bottom: 0.5rem !important;
  }
  
  /* Target the Info Icon Wrapper */
  .rubric-hover-wrap {
    position: absolute !important;
    top: 0.4rem !important; /* Align vertically with title text */
    left: 50% !important;
    /* 
       We need to push it right relative to the left-aligned title text.
       Container is centered 90% wide. Text starts at left edge of that container.
       "Rubric" text is roughly 4-5rem wide.
       So we transform from center - 45% (left edge) + 6rem (text width).
    */
    transform: translateX(calc(-50% - 4.5rem + 15px)) !important; /* Adjust until it sits next to Rubric */
    /* Wait, simpler calculation:
       Left edge of card is at (100% - 90%)/2 = 5%.
       Title is at 5%.
       We want icon at 5% + TitleWidth.
    */
    margin: 0 !important;
    width: auto !important;
    display: block !important;
    z-index: 10 !important;
    /* Reset previous transforms */
    right: auto !important;
  }
  
  /* Fix layout specific calculation because previous logic was messy */
  .rubric-box {
      position: relative !important;
      padding-top: 3rem !important; /* Space for title header */
      display: block !important; /* Allow absolute positioning inside to work relative to this block */
      width: 100% !important;
      max-width: 100% !important;
  }
  
  /* Re-center the card itself */
  .rubric-card {
    margin: 0 auto 2rem auto !important;
  }

  /* Since calculating strict pixel widths in CSS calc() is flaky without fixed container size,
     let's try a different approach: Flex header for title and icon.
     But HTML structure is [Icon] [Title] [Card].
     We can position Icon absolute relative to Title if Title was relative, but they are siblings.
     
     HTML:
     .rubric-hover-wrap (Icon)
     h2.page-title (Rubric)
     .rubric-card
  */
  
  /* Let's use Grid on the container to place them! */
  .rubric-box {
    display: grid !important;
    /* Rows: Header (Title+Icon), Card */
    grid-template-areas: 
      "title icon"
      "card card" !important;
    grid-template-columns: max-content max-content !important; /* Shrink to fit content */
    align-content: start !important;
    justify-content: start !important; /* Align content to the left of the box */
    align-items: center !important;
    column-gap: 0.5rem !important; /* Space between Title and Icon */
    row-gap: 0.5rem !important;
    padding-top: 0 !important;
    width: 90% !important; 
    max-width: 400px !important;
    margin: 0 auto 1.5rem auto !important;
  }
  
  /* The Title */
  .rubric-box > .page-title {
    grid-area: title !important;
    position: static !important;
    transform: none !important;
    width: auto !important;
    text-align: left !important;
    margin: 0 !important;
    display: block !important;
    padding: 0 !important;
  }

  /* The Icon Wrapper */
  .rubric-hover-wrap {
    grid-area: icon !important;
    position: relative !important; /* Relative for panel positioning */
    justify-self: start !important; 
    top: auto !important;
    left: auto !important;
    transform: none !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    z-index: 50 !important; /* Ensure on top */
  }
  
  .rubric-hover-panel {
     position: absolute !important;
     top: 100% !important;
     left: 0 !important; /* Align left edge with icon or shift slightly? */
     transform: none !important;
     margin-top: 0.5rem !important;
     width: 16rem !important;
     max-width: 60vw !important; /* Ensure it fits on screen better */
     z-index: 100 !important;
     display: none !important;
  }

  .rubric-hover-wrap:hover .rubric-hover-panel {
     display: block !important; /* ensure visibility */
  }

  /* Reset Videos Panel for Mobile */
  .videos-panel {
    width: 100% !important;
    min-height: auto !important;
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    background: transparent !important;
    border: none !important;
    padding: 1rem 0 !important;
    display: none; 
  }

  .videos-panel.is-open {
    display: block !important;
    animation: none !important;
  }

margin-bottom: 0.5rem !important;
    padding: 0.5rem !important;
    border-radius: 0.5rem !important;
  }
}
